<template>
	<view class="">
		<tn-popup v-model="showPopup">
			<view v-if="tmpData !== null" style="padding: 20px;display: flex;flex-direction: column;gap: 20px;">
				<view style="display: flex;">
					<view class="title-header">支付金额</view>
					<view>￥<text>{{((tmpData.aprice ?? 0) / 100).toFixed(2)}}</text>元</view>
				</view>
				<view style="display: flex;">
					<view class="title-header">收货人</view>
					<view></view>
				</view>
				<view style="display: flex;">
					<view class="title-header">电话</view>
					<view></view>
				</view>
				<view style="display: flex;">
					<view class="title-header">区域</view>
					<view></view>
				</view>
				<view style="display: flex;">
					<view class="title-header">地址</view>
					<view></view>
				</view>
				<view>微信支付</view>
			</view>
		</tn-popup>
	</view>
</template>

<script>
	import utils from '../../common/utils';

	export default {
		name: "wxpay-pop",
		data() {
			return {
				sConf: getApp().globalData,
				showPopup: false,
				tmpData: null,
				address: null,
			};
		},
		methods: {
			open(e) {
				if (e) {
					console.log('open', e);
					this.tmpData = e
				}
				this.showPopup = !this.showPopup;
				this.loadStaffAddress()
			},
			/**
			 * 加载用户收货地址
			 */
			loadStaffAddress() {
				let host = this.sConf.host + '/weapps/address/';
				let token = this.sConf.token || '';
				let data = {
					sid: this.sConf.auth.id
				}
				utils.authenticatorList(host, token, data).then((res) => {
					console.log('加载收货地址', res);
					if (res.rescode === 200) {
						this.address = res.resmsg
					}
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.title-header {
		font-weight: bold;
		padding-right: 10px;
		white-space: nowrap;
	}
</style>